package dom;

import org.w3c.dom.*;
import javax.xml.parsers.*;
import dom.*;

public class DOMDocument {

/** It creates a DOM document from sourceFile. sourceFile must be a well-formated XML file.
Return a document.
*/
 public Document createDOMDocument(String sourceFile) {
  try {
   DocumentBuilderFactory myFactory = DocumentBuilderFactory.newInstance();
   DocumentBuilder myBuilder = myFactory.newDocumentBuilder();
   FileInputStream inFile = new FileInputStream(sourceFile);
   myDocument = myBuilder.parse(inFile);
  }
  catch (Exception e) { 
   System.out.println(e.getMessage());
   e.printStackTrace();
  }
 return myDocument;
 }
}
